package cn.isjinhao.se.sql.grammar.statement.retrieve.represention;

import cn.isjinhao.se.sql.grammar.CurdStatement;
import cn.isjinhao.se.sql.grammar.CurdStatementVisitor;
import cn.isjinhao.se.sql.grammar.statement.Binary;
import cn.isjinhao.se.sql.lexical.token.Token;

/**
 * @author 01395265
 * @date 2021/3/3
 */
public class TableSeg extends Binary {

    // cross or left or right or full or null
    private Token qualifier;

    // inner or outer or null
    private Token modifier;

    // join or ,
//    private Token token;

    /**
     * logic
     */
    private CurdStatement condition;


    public TableSeg(Token qualifier, Token modifier, CurdStatement leftCurdStatement, Token token, CurdStatement rightCurdStatement, CurdStatement condition) {
        super(leftCurdStatement, token, rightCurdStatement);
        this.qualifier = qualifier;
        this.modifier = modifier;
        this.condition = condition;
    }

    public TableSeg(Token qualifier, Token modifier, CurdStatement leftCurdStatement, Token token,
                    CurdStatement rightCurdStatement) {
        super(leftCurdStatement, token, rightCurdStatement);
        this.qualifier = qualifier;
        this.modifier = modifier;
    }

    @Override
    public <R> R accept(CurdStatementVisitor<R> curdStatementVisitor) {
        return curdStatementVisitor.visitTableSeg(this);
    }

    public CurdStatement getCondition() {
        return condition;
    }

    public Token getQualifier() {
        return qualifier;
    }

    public Token getModifier() {
        return modifier;
    }
}
